package top.oneit.jdownload.test;

import java.applet.Applet;
import java.applet.AudioClip;
import java.io.File;
import java.net.URI;

/**
 * @author lingkang
 * @date 2021/12/11
 */
public class MyMusic02 {
    public static void main(String[] args) throws Exception {
        File file = new File("C:\\Users\\Administrator\\Desktop\\aoUner_-_231148159229145189230181129.wav");
        URI uri = file.toURI();
        System.out.println(uri);
        // AudioClip 只能播放 wav 格式的music
        AudioClip audioClip = Applet.newAudioClip(uri.toURL());
        audioClip.play();// 独立线程播放
        //循环播放
        audioClip.loop();
        Thread.sleep(15000);
    }
}
